<?

//-----------clasa Mailer este folosita pentru a trimite mailuri membrilor--------

//!!!!eroare daca serverul nu este setat sa trimita mailuri

class Mailer
    {
    //trimite mail la inregistrare cu datele de inregistrare
    function sendWelcome($user, $email, $pass)
        {
        $from   ="From: " . EMAIL_FROM_NAME . " <" . EMAIL_FROM_ADDR . ">";
        $subject="Campus on-line - Welcome!";
        $body   =$user . ",\n\n" . "Welcome! You've just registered at Campus on-line "
            . "with the following information:\n\n" . "Username: " . $user . "\n" . "Password: " . $pass . "\n\n"
            . "If you ever lose or forget your password, a new "
            . "password will be generated for you and sent to this "
            . "email address, if you would like to change your " . "email address you can do so by going to the "
            . "My Account page after signing in.\n\n" . "- Campus on-line";

        return mail($email, $subject, $body, $from);
        }

    //trimite noua parola daca userul a cerut modificarea acesteia
    function sendNewPass($user, $email, $pass)
        {
        $from   ="From: " . EMAIL_FROM_NAME . " <" . EMAIL_FROM_ADDR . ">";
        $subject="Campus on-line - Your new password";
        $body   =$user . ",\n\n" . "We've generated a new password for you at your "
            . "request, you can use this new password with your " . "username to log in to Campus on-line.\n\n"
            . "Username: " . $user . "\n" . "New Password: " . $pass . "\n\n"
            . "It is recommended that you change your password " . "to something that is easier to remember, which "
            . "can be done by going to the My Account page " . "after signing in.\n\n" . "- Campus on-line";

        return mail($email, $subject, $body, $from);
        }
    }

;

//instanta clasa
$mailer=new Mailer;
?>